#include <stdlib.h>
#include "../core/epdpaint.h"
#include "../core/epd420RWS19A.h"
#include "clock.h"
#include "string.h"
#define COLORED      0
#define UNCOLORED    1
#define TIME_X 60 //显示时间的x位置
#define TIME_Y 125 //显示时间的y位置
#define SQUARE_SIDE_MIN 10
#define SQUARE_SIDE_X 390
#define SQUARE_SIDE_Y 290


/*
 * 绘制时钟⏰界面
 */
void PaintClock(Epd epd){
     unsigned char* frame_black = (unsigned char*)malloc(epd.width * epd.height / 8);
    unsigned char* frame_red = (unsigned char*)malloc(epd.width * epd.height / 8);

    Paint paint_black(frame_black, epd.width, epd.height);
    Paint paint_red(frame_red, epd.width, epd.height);
    paint_black.Clear(UNCOLORED);
    paint_red.Clear(COLORED);

    int lx=380/2-20;//170
    
    int miX=(lx-SQUARE_SIDE_MIN-strlen("11:10"))/2;
    int miy=280/2-48;
    paint_black.DrawRectangle(SQUARE_SIDE_MIN, SQUARE_SIDE_MIN, SQUARE_SIDE_X, SQUARE_SIDE_Y, COLORED);
    paint_black.DrawStringAt(30, miy, "11:10", &Font48, COLORED);
    

    // int x=(380/2-50)/2;
    
    paint_black.DrawStringAt(36, miy+50+16, "2021-11-06", &Font16, COLORED);
    paint_black.DrawStringAt(58, miy+50+16*2, "Sunday", &Font16, COLORED);
   
    paint_black.DrawVerticalLine(lx,40, 220, COLORED);//x1,y1,x2,y2

    epd.SetFrameScreen_ALL(frame_black, frame_red);
}